/**
 * 
 */
package com.google.code.cisx;

import com.google.code.cisx.model.CommonUpdatableModelEntity;
import com.google.code.cisx.model.project.BuildDefinition;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @version $Id: CIService.java 258 2008-11-29 06:23:51Z rahul.thakur.xdev $
 * @since 1.0
 */
public interface CIService {

  /**
   * Obtains an instance of the Entity specified by the passed in identifier.
   * 
   * @param <T>
   * @param klass
   * @param id
   * @return
   * @throws CIServiceException
   */
  public <T extends CommonUpdatableModelEntity> T lookup(Class<T> klass, Long id) throws CIServiceException;

  /**
   * Persists an entity instance to underlying storage.
   * 
   * @param <T>
   * @param klass
   * @param entity
   * @return
   * @throws CIServiceException
   */
  public <T extends CommonUpdatableModelEntity> T save(Class<T> klass, T entity) throws CIServiceException;

  /**
   * For the specified project identifier, removes the project instance from the
   * underlying storage.
   * 
   * @param <T>
   * @param klass
   * @param entity
   * @throws CIServiceException
   */
  public <T extends CommonUpdatableModelEntity> void delete(Class<T> klass, T entity) throws CIServiceException;

  /**
   * Creates a build from the specified build definition Id for an associated
   * project.
   * 
   * @param build
   * @return
   * @throws CIServiceException
   */
  public Long executeBuild(BuildDefinition build) throws CIServiceException;

}
